cflags := -mgeneral-regs-only -mno-sse -mno-mmx -mno-80387 -mno-red-zone -fno-pic -nostdlib -mcmodel=large

build: hal.o

hal.o: io.o mem.o int.o platform.o
	# gcc -m64 int.c io.c mem.c -I ../inc -c
	# touch hal.o
	ld -r io.o int.o mem.o platform.o -o hal.o
	cp ./hal.o ../hal.o

clean:
	# rm hal.o io.o int.o mem.o
	rm *.o

int.o: int.c 
	gcc int.c $(cflags) -m64 -I ../inc -c int.o 

io.o: io.c 
	gcc io.c $(cflags) -m64 -I ../inc -c io.o

mem.o: mem.c 
	gcc mem.c $(cflags) -m64 -DAMD64 -I ../inc -c mem.o

platform.o: platform.c
	gcc platform.c $(cflags) -m64 -I ../inc -c platform.o
